//
//  YYComposeMenuButton.swift
//  YYWeibo
//
//  Created by strongwallyi on 16/1/8.
//  Copyright © 2016年 strongwallyi. All rights reserved.
//

import UIKit

class YYComposeMenuButton: UIButton {

    override var highlighted: Bool {
        set{
            
        }
        get{
            return false
        }
    }
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        setupUI()
        
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    private func setupUI(){
        //设置字体的颜色和居中对齐
        titleLabel?.font = UIFont.systemFontOfSize(16)
        setTitleColor(UIColor.darkGrayColor(), forState: UIControlState.Normal)
        titleLabel?.textAlignment = .Center
    }
    
    override func layoutSubviews() {
        super.layoutSubviews()
        //图片放在上面
        imageView?.frame.origin.x = 0
        imageView?.frame.origin.y = 0
        imageView?.frame.size = CGSize(width: frame.width, height: frame.width)
        
        //label 放在下面
        titleLabel?.frame.origin.x = 0
        titleLabel?.frame.origin.y = frame.width
        titleLabel?.frame.size = CGSize(width: frame.width, height: frame.height - frame.width)
    }
}
